<?php
namespace app\backend\models;

use app\backend\lib\ArDBLib;

class RoleMenuModel extends ArDBLib{

    public static function tableName(){
        return '@role_menu';
    }

    /**
     * 全部权限
     * @param array $where
     * @return array
     */
    public function getRoleGroup(){
        $data = self::find()->join([['left join','@role_group','@role_group.group_id = @role_menu.group_id'],['left join','@backend_menu','@backend_menu.menu_id = @role_menu.menu_id']])->all();
        $resData=[];
        foreach ($data as $k=>$v){
            $v['menu_c'] = explode(',',$v['menu_c']);
            $resData[$v['group_id']][] = $v;
        }
        return $resData;
    }

}